package edu.hku.c3330.hkucompanion.manager;

import java.util.Calendar;

public class CalendarUtils 
{
	
	public static void clearHMS(Calendar cal)
	{
		cal.set(Calendar.HOUR, 0);
		cal.set(Calendar.MINUTE, 0);
		cal.set(Calendar.SECOND, 0);
		cal.set(Calendar.MILLISECOND, 0);
	}
	
	public static Calendar emptyCalendar()
	{
		Calendar cal = Calendar.getInstance();
		cal.set(0, 0, 0);
		clearHMS(cal);
		return cal;
	}
	
	public static void addCalendar(Calendar base, Duration dur)
	{
		base.add(Calendar.MILLISECOND, dur.millisecond);
		base.add(Calendar.SECOND, dur.second);
		base.add(Calendar.MINUTE, dur.minute);
		base.add(Calendar.HOUR_OF_DAY, dur.hour);
		base.add(Calendar.DATE, dur.date);
		base.add(Calendar.MONTH, dur.month);		
		base.add(Calendar.YEAR, dur.year);		
	}
}
